package com.ruoyi.ufox.service.impl;


import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ufox.domain.BisDevicePhoto;
import com.ruoyi.ufox.mapper.BisDevicePhotoMapper;
import com.ruoyi.ufox.service.IBisDevicePhotoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 照片管理Service业务层处理
 * 
 * @author ufoxs
 * @date 2022-08-16
 */
@Service
public class BisDevicePhotoServiceImpl implements IBisDevicePhotoService
{
    @Autowired
    private BisDevicePhotoMapper bisDevicePhotoMapper;

    /**
     * 查询照片管理
     * 
     * @param photoId 照片管理主键
     * @return 照片管理
     */
    @Override
    public BisDevicePhoto selectBisDevicePhotoByPhotoId(Long photoId)
    {
        return bisDevicePhotoMapper.selectBisDevicePhotoByPhotoId(photoId);
    }

    /**
     * 查询照片管理列表
     * 
     * @param bisDevicePhoto 照片管理
     * @return 照片管理
     */
    @Override
    public List<BisDevicePhoto> selectBisDevicePhotoList(BisDevicePhoto bisDevicePhoto)
    {
        return bisDevicePhotoMapper.selectBisDevicePhotoList(bisDevicePhoto);
    }

    /**
     * 新增照片管理
     * 
     * @param bisDevicePhoto 照片管理
     * @return 结果
     */
    @Override
    public int insertBisDevicePhoto(BisDevicePhoto bisDevicePhoto)
    {
        bisDevicePhoto.setCreateTime(DateUtils.getNowDate());
        return bisDevicePhotoMapper.insertBisDevicePhoto(bisDevicePhoto);
    }

    /**
     * 修改照片管理
     * 
     * @param bisDevicePhoto 照片管理
     * @return 结果
     */
    @Override
    public int updateBisDevicePhoto(BisDevicePhoto bisDevicePhoto)
    {
        bisDevicePhoto.setUpdateTime(DateUtils.getNowDate());
        return bisDevicePhotoMapper.updateBisDevicePhoto(bisDevicePhoto);
    }

    /**
     * 批量删除照片管理
     * 
     * @param photoIds 需要删除的照片管理主键
     * @return 结果
     */
    @Override
    public int deleteBisDevicePhotoByPhotoIds(Long[] photoIds)
    {
        return bisDevicePhotoMapper.deleteBisDevicePhotoByPhotoIds(photoIds);
    }

    /**
     * 删除照片管理信息
     * 
     * @param photoId 照片管理主键
     * @return 结果
     */
    @Override
    public int deleteBisDevicePhotoByPhotoId(Long photoId)
    {
        return bisDevicePhotoMapper.deleteBisDevicePhotoByPhotoId(photoId);
    }

    @Override
    public boolean select(String modelName, String colorName, Long photoId) {
        Integer deviceCode = bisDevicePhotoMapper.select(modelName, colorName, photoId);
        return deviceCode>0?true : false;
    }
}
